
int COLS = 20;
int ROWS = 2;

PImage img;

void setup(){
  img = loadImage("automat.png");

  int length = COLS * ROWS * 16;

  print("byte line["+length+"] = {");
  for(int r = 0; r<ROWS; r++){
    for(int c = 0; c<COLS; c++){

      for(int ir=0; ir<8; ir++){
        int bp1 = 0;
        int bp2 = 0;


        for(int ic=0; ic<8; ic++){
          color p = img.get(c*8+ic, r*8+ir);
          if(red(p) > 128) {
            bp1 += 1 << (7-ic);
          }
          bp2 = bp1;
        } 
        print(bp1+","+bp2+",");
      }
    } 
  }
  println("}");
}

